<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>匹配</title>
</head>
<body>
  <div id="app">
    <h1>Hello Vue Router!</h1>
    <p>
      <router-link to='/user-bar'>bar用户</router-link>
      <router-link to='/user-foo'>foo用户</router-link>
    </p>
    <router-view></router-view>
  </div>
</body>
<!-- 引入vue -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- 引入VueRouter -->
<script src="https://unpkg.com/vue-router@2.0.0/dist/vue-router.js"></script>
<script>
  const User = {
    template:`
      <div>
        <h1> 这里是User组件 {{ $route.params.pathMatch }}</h1>  
      </div>
    `
  }
  const NoFond ={
    template:`
     <div>
      <h1> 404---{{ $route.params.pathMatch }} </h1>
     </div>
    `
  }

  var routes = [
    {path:'/user-*',component: User},
    {path:'*',component:NoFond},
  ]

  var router = new VueRouter({
    routes
  })

  const app = new Vue({
    el:'#app',
    router
  })
</script>
</html>